package com.itheima.rocketmq.rocketmqdemo.base;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description:
 * @author: ycc
 * @time: 2021/3/31
 */
public class Main {
//    static Integer num = 0;
    static AtomicInteger num = new AtomicInteger(0);
    public static void main(String[] args) {
        for (int i=0;i<1000;i++){
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
//                    synchronized(Main.class){
                        while (num.get() < 1000){
                            System.out.println("thread name:"+Thread.currentThread().getName()+":");
                        }
//                    }
                }
            });
            t.start();
        }
    }
}


